package com.datawin.taotaocheche.ui.actviity.user.presenter;

import java.util.List;

import javax.inject.Inject;

import com.datawin.taotaocheche.base.BaseBiz;
import com.datawin.taotaocheche.bean.MsgInfo;
import com.datawin.taotaocheche.comm.MyApplication;
import com.datawin.taotaocheche.ui.actviity.user.biz.MsgBiz;
import com.datawin.taotaocheche.ui.actviity.user.contract.MsgContract;

/**
 * Created by Administrator on 2017/10/21.
 */

public class MsgPresenter implements MsgContract.Presenter {

    MsgContract.View view;
    MsgBiz msgBiz;


    @Inject
    public MsgPresenter(MsgContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        msgBiz = (MsgBiz) biz;
    }

    @Override
    public void GetMsg() {
        view.loading(true);
        msgBiz.messagePage(MyApplication.userInfo.getUserCode(), new BaseBiz.Callback<List<MsgInfo>>() {
            @Override
            public void onSuccess(List<MsgInfo> o) {
                view.updateBill(o);
                view.loading(false);
            }

            @Override
            public void onFailure(List<MsgInfo> o) {
                view.loading(false);
            }
        });
    }
}
